package com.btashov.datastructure;

public class Node {
    private char data;
    private int id;
    private Node next;
    private Node prev;

    public Node() {
    }

    public Node(char data) {
        this.data = data;
    }

    public Node(int id) {
        this.id = id;
    }

    public char getData() {
        return data;
    }

    public void setData(char data) {
        this.data = data;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public Node getNext() {
        return next;
    }

    public void setNext(Node next) {
        this.next = next;
    }

    public Node getPrev() {
        return prev;
    }

    public void setPrev(Node prev) {
        this.prev = prev;
    }

    @Override
    public int hashCode() {
        return 31 * (int) data + id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Node)) return false;

        Node node = (Node) o;
        return id == node.id && data == node.data;

    }
}
